#include <iostream>
using namespace std;

class Base {
public:
  Base(int i): baseI(i) {}
  virtual void print(void){
    cout << "Call Base::print()" << endl;
  }
  virtual void setI() {
    cout << "Call Base::setI()" << endl;
  }
  virtual ~Base() {}
private:
  int baseI;
};

class Derive1 : public Base {
public:
  Derive1(): Base(1) {}
  virtual void print(void) {
    cout << "Call Derive1::print()" << endl;
  }
};

class Derive2 : public Base {
public:
  Derive2(): Base(2) {}
  virtual void print(void) {
    cout << "Call Derive2::print()" << endl;
  }
};

void print(Base* obj) {
  obj->print();
}

void test() {
  Base *ptr1 = new Base(1);
  Base *ptr2 = new Derive1();
  Base *ptr3 = new Derive2();
  
  print(ptr1);
  print(ptr2);
  print(ptr3);

  delete ptr1;
  delete ptr2;
  delete ptr3;
}


int main() {
  test();
  return 0;
}
